// stores/counter.js
import { defineStore } from 'pinia';
import {ref} from 'vue';

export const useCounterStore = defineStore('counter', () => {
	const count = ref(0);
	function increment() {
		count.value++;
		console.log('count.value',count.value)
	}

	return { count, increment };
});


export const useCounterStore2 = defineStore('counter2', {
	state: () => {
		return { count: 0 };
	},
	// 也可以这样定义
	// state: () => ({ count: 0 })
	actions: {
		increment() {
			this.count++;
		},
	},
});